<template>
  <div id="app">
    <!-- <div id="nav">
      <router-link to="/">Home</router-link> |
      <router-link to="/about">About</router-link>
    </div> -->
    <router-view />
  </div>
</template>
<script>
export default {
  data() {
    return {};
  },
  created() {
    // this.$store.state.tabList.filter((item, index) => {
    //   console.log(item, index);
    //   // if (item.path === this.$route.history.current.fullPath){
    //   //   console.log("tab的下标为=",index);
    //   // }
    // });
    // console.log(this.$route);
  },
  mounted() {
    // window.addEventListener("beforeunload", (e) => this.beforeunloadHandler(e));
  },
  methods: {
    beforeunloadHandler(e) {
      alert("销毁");
      console.log("关闭后=>为所欲为");
    },
  },
  //页面销毁前解除监听
  // destroyed() {
  //   window.removeEventListener("beforeunload", (e) =>
  //     this.beforeunloadHandler(e)
  //   );
  // },
  beforeDestroy() {
    // console.log("");
    alert("销毁");
  },
};
</script>
<style>
* {
  margin: 0;
  padding: 0;
}
</style>
